<template>
  <view class="wantToDedicate">
    <block v-for="(item, index) in list" :key="index">
      <view class="item">
        <view class="title" v-if="item.isTitleShow">
          <text></text>
          <text class="_title">{{ item.title }}</text>
        </view>
        <view class="content">
          <block v-for="(a, b) in item.list" :key="b">
            <view class="content-item" @click="onTabClick(item, a, b)"
            v-if="a.show"
            >
              <image :src="a.img"></image>
              <view>{{ a.title }}</view>
            </view>
          </block>
        </view>
      </view>
    </block>
  </view>
</template>

<script>
  export default {
    name: 'WantToDedicate',
    props: {
      list: {
        //type是根据list类型决定的，如果list是数组 ，就是array,
        type: [Array, String],
        required: true,
      },
    },
    data() {
      return {}
    },
    methods: {
      //跳对面的页面
      onTabClick(item, a, b) {
        this.$emit('click', item, a, b)
      },
    },
  }
</script>

<style lang="scss" scoped>
  .wantToDedicate {
    .item {
      .title {
        display: flex;
        align-items: center;
        text {
          &:first-child {
            display: block;
            width: 7rpx;
            height: 46rpx;
            background-color: #1e6bd2;
          }
          &:last-child {
            white-space: nowrap;
            width: 110rpx;
            font-size: 28rpx;
            font-family: PingFang;
            font-weight: 500;
            color: #222222;
            padding-left: 16rpx;
          }
        }
      }
      .content {
        display: flex;
        flex-wrap: wrap;
        .content-item {
          width: 25%;
          box-sizing: border-box;
          text-align: center;
          padding-top: 47rpx;
          image {
            width: 70rpx;
            height: 70rpx;
          }
          view {
            white-space: nowrap;
            font-size: 24rpx;
            font-family: PingFang;
            font-weight: 500;
            color: #222222;
            padding-top: 19rpx;
          }
        }
      }
    }
  }
</style>
